package com.itheima.sh.controller;


import com.itheima.sh.pojo.Order;
import com.itheima.sh.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hl
 * @since 2021-01-06
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    OrderService orderService;

    @GetMapping("/{username}")
    public List<Order> findOrderByUserId(@PathVariable("username")String username){
       return orderService.findOrderByUserId(username);
    }

}
